//
//  JQFYTicketInfo_HeaderView.m
//  JQFY
//
//  Created by apple on 2017/9/2.
//  Copyright © 2017年 yannis. All rights reserved.
//

#import "JQFYTicketInfo_HeaderView.h"

@interface JQFYTicketInfo_HeaderView ()
@property (nonatomic ,strong) UIImageView *icon_img;
@property (nonatomic ,strong) UILabel *ticketName;
@property (nonatomic ,strong) UILabel *address_label;
@property (nonatomic ,strong) UILabel *date_label;
@property (nonatomic ,strong) UIButton *favouriteBtn;
@property (nonatomic ,assign) BOOL isfavourite;

@end

@implementation JQFYTicketInfo_HeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupUI];
    }
    return self;
}

-(void)setupUI{
    //标题图
    UIImage *img = [UIImage imageNamed:@"ticketInfo_icon"];
    self.icon_img = [[UIImageView alloc]initWithImage:img];
    [self addSubview:_icon_img];
    [_icon_img mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_offset(231);
        make.height.mas_offset(345);
        make.centerX.mas_equalTo(self);
        make.top.mas_equalTo(self).mas_offset(10);
    }];
    //标题
    self.ticketName = [[UILabel alloc] init];
    [self addSubview:_ticketName];
    _ticketName.text = @"【TOMORROWLAND】-First Land In China";
    _ticketName.font = [UIFont fontWithName:@"Arial-BoldMT" size:13];
    _ticketName.textColor = [UIColor whiteColor];
    _ticketName.textAlignment = NSTextAlignmentCenter;
    [_ticketName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.width.mas_equalTo(self);
        make.top.mas_equalTo(_icon_img.mas_bottom).mas_offset(7);
    }];
    //地址图标
    UIImageView *address_icon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ticketInfo_address"]];
    [self addSubview: address_icon];
    [address_icon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self).mas_offset(135);
        make.top.mas_equalTo(_ticketName.mas_bottom).mas_offset(12);
        make.width.height.mas_offset(12);
    }];
    //地址
    self.address_label = [[UILabel alloc] init];
    [self addSubview:_address_label];
    _address_label.text = @"上海八万人体育场";
    _address_label.font = [UIFont fontWithName:@"Arial-BoldMT" size:11];
    _address_label.textColor = [UIColor whiteColor];
    _address_label.textAlignment = NSTextAlignmentLeft;
    [_address_label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(address_icon.mas_right).mas_offset(7);
        make.top.mas_equalTo(_ticketName.mas_bottom).mas_offset(12);
        make.width.mas_offset(210);
    }];
    //日期
    self.date_label = [[UILabel alloc] init];
    [self addSubview:_date_label];
    _date_label.text = @"2017.10.12";
    _date_label.font = [UIFont fontWithName:@"Arial-BoldMT" size:10];
    _date_label.textColor = [UIColor whiteColor];
    _date_label.textAlignment = NSTextAlignmentCenter;
    [_date_label mas_makeConstraints:^(MASConstraintMaker *make) {
       make.centerX.width.mas_equalTo(self);
        make.top.mas_equalTo(_address_label.mas_bottom).mas_offset(5);
    }];
//    //点击收藏
//    self.favouriteBtn = [[UIButton alloc] init];
//    [self addSubview:_favouriteBtn];
//    self.isfavourite = NO;
//    if (_isfavourite == NO) {
//        [self.favouriteBtn setImage:[UIImage imageNamed:@"ticketInfo_myFavourite"] forState:UIControlStateNormal];
//    }else{
//        [self.favouriteBtn setImage:[UIImage imageNamed:@"ticketInfo_myFavouriteSelected"] forState:UIControlStateNormal];
//    }
//    [self.favouriteBtn addTarget:self action:@selector(didClickfavouriteBtn) forControlEvents:UIControlEventTouchUpInside];
//    
//    [_favouriteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.width.height.mas_equalTo(15);
//        make.top.mas_equalTo(self).mas_offset(15);
//        make.right.mas_equalTo(self).mas_equalTo(-15);
//    }];
}
////点击我喜欢
//-(void)didClickfavouriteBtn{
//    NSLog(@"点击了我喜欢");
//    if (_isfavourite == NO) {
//        _isfavourite = YES;
//        [self.favouriteBtn setImage:[UIImage imageNamed:@"ticketInfo_myFavouriteSelected"] forState:UIControlStateNormal];
//    }else if(_isfavourite == YES){
//        _isfavourite = NO;
//        [self.favouriteBtn setImage:[UIImage imageNamed:@"ticketInfo_myFavourite"] forState:UIControlStateNormal];
//    }
//}

@end
